import {Component} from 'react'
import One from  './one'
import Two from  './two'

class Parent extends Component{

    constructor(props){
        super(props)
        this.state={
            msgParent:""
        }
       
    }

    getdataFromChild=(msg)=>{
        this.setState({
            msgParent: msg
        })
    }


    render(){
        return (
           <div>
               <h1>父组件</h1>
               <hr></hr>
               <One val={this.state.msgParent}></One>
               <hr></hr>
               <Two mymethod={this.getdataFromChild}></Two>
           </div> 
        )

    }
}

export default Parent
